package com.interfaces;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.entity.Collector;
import com.entity.Org;

/**   
* @Title: OrdDao.java 
* @Package com.interfaces 
* @author 孙梦楠 
* @date 2017年7月19日 下午4:32:47 
* @version V1.0.0   
*/

public interface OrgDao extends JpaRepository<Org, Integer>{
	
	
	List<Org> findByOrgfatherOrderByOrgordDesc(String orgfather);
	
	Org findByOrgvalue(String orgvalue);
	
	//根据上级查小区
	List<Org> findByOrgfather(String orgfather);
	//小区列表
	@Transactional
	@Query(value = "SELECT o FROM Org o WHERE (o.orgfather=?1 OR ?1 IS NULL) AND o.orgfather !=0")
	public List<Org> findAreaByConditions(String orgfather);
	//公司列表
	@Transactional
	@Query(value = "SELECT o FROM Org o WHERE o.orgfather =0")
	public List<Org> findCompanyByConditions();
	


}
